//
//  TDTryDriveQuanListCell.m
//  TBRentClient
//
//  Created by tonbright on 2018/6/21.
//  Copyright © 2018年 tonbright. All rights reserved.
//

#import "TDTryDriveQuanListCell.h"
#import "YXDateHelpObject.h"
@implementation TDTryDriveQuanListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.lbe_array = [NSMutableArray array];
    for (UIView *subView in self.contentView.subviews) {
        if ([subView isKindOfClass:[UILabel class]]) {
            [_lbe_array addObject:subView];
        }
    }
}

- (void)setTryDriveQuanModel:(TDTryDriveQuanModel *)tryDriveQuanModel {
    _tryDriveQuanModel = tryDriveQuanModel;
    _lbe_couponNum.text = tryDriveQuanModel.couponno;
    _lbe_brandnm.text = [NSString stringWithFormat:@"%@ %@",tryDriveQuanModel.brandnm,tryDriveQuanModel.typenm];
    
//    NSString *fromStr = [[YXDateHelpObject manager] getStrDateFromStrDate:tryDriveQuanModel.validfrom OldFormat:@"yyyy-MM-dd HH:mm:ss" ByNewFormat:@"yyyy-MM-dd"];
    NSString *fromStr = [HelpObject changeNull:tryDriveQuanModel.validfrom];
//    NSString *endStr = [[YXDateHelpObject manager] getStrDateFromStrDate:tryDriveQuanModel.validto OldFormat:@"yyyy-MM-dd HH:mm:ss" ByNewFormat:@"yyyy-MM-dd"];
    NSString *endStr = [HelpObject changeNull:tryDriveQuanModel.validto];

    _lbe_FromToDate.text = [NSString stringWithFormat:@"%@ 到 %@",fromStr,endStr];
    
    if (tryDriveQuanModel.isSel) {
        _imv_status.image = [UIImage imageNamed:@"试驾圆选中"];
    }else {
        _imv_status.image = [UIImage imageNamed:@"试驾圆未选中"];
    }
    
}

- (void)setSection:(NSInteger)section {
    _section = section;
    if (section == 0) {
        for (UILabel *lbe in self.lbe_array) {
            lbe.textColor = [UIColor blackColor];
        }
    }else {
        for (UILabel *lbe in self.lbe_array) {
            lbe.textColor = [UIColor lightGrayColor];
        }
    }
}

- (void)setIsFromCal:(BOOL)isFromCal {
    _imv_status.hidden = !isFromCal;
    
}


@end
